package com.shigen.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shigen.demo.entity.User;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * (SysUser)表数据库访问层
 *
 * @author shigen
 * @since 2022-03-05 17:06:48
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 查询user.id>id的数据，并分页
     *
     * @param id       user.id
     * @param pageSize 页面容量
     * @return 查询的数据
     */
    @Select("select * from user where user.id > #{id} limit #{pageSize};")
    List<User> findNewPage(@Param("id") Long id, @Param("pageSize") int pageSize);

    /**
     * 渗透测试
     *
     * @param id id
     * @return 列表数据
     */
    @Select("select * from user where id > ${id} limit 10;")
    List<User> penetrationQuery(@Param("id") Long id);

    @Select("select * from user where id = #{id}")
    User findById(@Param("id") Long id);

    @Select("select * from user where id = #{id}")
    User findById1(String id);

    @Select("select * from user where id = ${id}")
    User findById2(@Param("id") String id);
}

